package models.mappers;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import vos.MenuSearchVo;
import vos.SystemMenuView;
import models.Operator;
import models.Region;
import models.RegionLevel;
import models.RegionLevelRelation;
import models.Role;
import models.RoleMenu;
import models.RoleUser;
import models.SystemMenu;

public interface RegionLevelRelationMapper {
	/**
	 * 获取已启用城市等级列表
	 *
	 * @Title: getRole 
	 * @return
	 * @return: List<Role>
	 */
	@Select("select levelid,levelname from "
			+ RegionLevel.TABLE_NAME
			+" where isflag=0")
	List<RegionLevel> getRole();
	/**
	 * 获取选中的地区
	 *
	 * @Title: getSelectRegion 
	 * @param levelid 城市等级id
	 * @return
	 * @return: List<String>
	 */
	@Select("select regionid from region_level_relation"
			+ " where levelid=#{levelid}")
	List<String> getSelectRegion(String levelid);
	/**
	 * 查询第一级地区	
	 *
	 * @Title: getFRegion 
	 * @return
	 * @return: List<Region>
	 */
	@Select("select id,text from region where pid is null")
	List<Region> getFRegion();
	/**
	 * 根据pid查询地区
	 *
	 * @Title: getSRegions 
	 * @param id
	 * @return
	 * @return: List<SystemMenu>
	 */
	@Select("select id,text from region where pid=#{id}")
	List<Region> getSRegions(String id);
	/**
	 * 获取城市等级列表
	 *
	 * @Title: getRegionLevel 
	 * @return
	 * @return: List<RegionLevel>
	 */
	@Select("select levelid,levelname from region_level  where isflag=0")
	List<RegionLevel> getRegionLevel();
	/**
	 * 删除等级下的地区设置
	 *
	 * @Title: deleteRegionLevelRelation 
	 * @param levelid 城市等级
	 * @return: void
	 */
	@Delete("delete from region_level_relation where levelid=#{levelid}")
	void deleteRegionLevelRelation(String levelid);
	/**
	 * 保存城市信息
	 *
	 * @Title: saveRegionLevelRelation 
	 * @param smap
	 * @return: void
	 */
	void saveRegionLevelRelation(Map<String, List<RegionLevelRelation>> smap);
}
